<?php /*a:2:{s:55:"G:\project\insure\view\admin\content\content_edit.phtml";i:1592733505;s:39:"G:\project\insure\view\admin\base.phtml";i:1592839392;}*/ ?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>HQadmin</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/static/hqui/libs/layui/css/layui.css"/>
    <link rel="stylesheet" href="/static/hqui/module/admin.css?v=316"/>
  <link rel="stylesheet" href="/static/css/fonts.css">
  <link rel="stylesheet" href="/static/css/base.css">
  
</head>

<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        
<link rel="stylesheet" href="/static/dist/basic.min.css" />
<link rel="stylesheet" href="/static/dist/dropzone.min.css" />

<div  style="width: 800px;height: 1600px">
    <div class="layui-card-body">
        <form action="<?php echo request()->url(); ?>" class="layui-form" method="post">
            <div class="layui-form-item">
                <label class="layui-form-label">内容</label>
                <div class="layui-input-block">
                    <input name="content" hidden="hidden" value="<?php echo htmlentities((isset($data['content']) && ($data['content'] !== '')?$data['content']: '')); ?>">
                    <script id="editor" type="text/plain" ></script>
                </div>
            </div>
            <input name="isedit" value="<?php echo input('isedit'); ?>" hidden="hidden">

            <textarea hidden="hidden" id="htmlcon"><?php echo htmlentities((isset($data['content']) && ($data['content'] !== '')?$data['content']: '')); ?></textarea>
        </form>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-filter="i" id="sub" >保存</button>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script src="/static/js/clipboard.js"></script>
<script src="/static/dist/dropzone.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.all.js"> </script >


    </div>
</div>

<script type="text/javascript" src="/static/hqui/libs/layui/layui.all.js"></script>
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/js/layui.base.js"></script>
<script type="text/javascript" src="/static/hqui/js/common.js?v=316"></script>
<script type="text/javascript">

    //工具函数 将表单里数据 序列化成json对象
    $.fn.serializeJson=function(){
        var serializeObj={};
        var array=this.serializeArray();
        var str=this.serialize();
        $(array).each(function(){
            if(serializeObj[this.name]){
                if($.isArray(serializeObj[this.name])){
                    serializeObj[this.name].push(this.value);
                }else{
                    serializeObj[this.name]=[serializeObj[this.name],this.value];
                }
            }else{
                serializeObj[this.name]=this.value;
            }
        });
        return serializeObj;
    };

    function refreshArea(_formWin){
        var _formWinObj = $("#layui-layer"+_formWin);
        var w = _formWinObj.outerWidth();
        var h = _formWinObj.outerHeight();
        var l = ($(document).width()-w)/2;
        var t = ($(window).height()-h)/2;
        _formWinObj.css({
            "left":l,
            "top":t
        });
    }
</script>

<script>
    $('#sub').click(function(){
        $('input[name="content"]').val(ue.getContent());
        if($('input[name="path"]').val() == ''){
            layer.open({
                content: '主图必须上传' //这里content是一个普通的String
            });
            return;
        }

        if($('input[name="path"]').val() == ''){
            layer.open({
                content: '主图必须上传' //这里content是一个普通的String
            });
            return;
        }

        var data = $('form').serializeJson();
        $.ajax({
            url:'content_add',
            data: data,
            method:'post',
            success:function(res){
                layer.open({
                    content: res.msg, //这里content是一个普通的String
                    end: function(){ //此处用于演示
                        if(res.code == 1){
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.location.reload();//刷新父页面，注意一定要在关闭当前iframe层之前执行刷新
                            parent.layer.close(index); //再执行关闭
                        }
                    }
                });


            }
        });
    })

    var ue = UE.getEditor( 'editor', {

        autoHeightEnabled: true,

        autoFloatEnabled: true,

        initialFrameWidth: 580,

        initialFrameHeight:400,
    });

    ue.ready(function() {
        var htmlcon=$('#htmlcon').text();
        ue.setContent(htmlcon);
    });
</script>

</body>
</html>